<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initail-scale=1">
<title>首页</title>
<link rel="stylesheet" href="{{asset('/mobile/test/css/style.css')}}">
<script>
window.onload=onresize=function(){
    var html=document.documentElement;
    html.style.fontSize=document.documentElement.clientWidth/16+'px';
};  
</script>
</head>

<body>
    <header>
        <div class="avatar">
            <span><img src="{{$agent->avatar}}"></span>
            <!-- <i>@if($agent->pid == 0) 一级推广 @else 二级推广 @endif</i> -->
            <i>@if($agent->level == 1) 一级推广 @elseif($agent->level == 2) 二级推广 @elseif($agent->level == 3) 三级推广 @endif</i>
        </div>
        <div class="username">
            <h3>{{$agent->realname}}</h3>
            <p>推广员编号：<span>{{$agent->id}}</span></p>
        </div>
    </header>
    <div class="param flex">
        <div class="flex-item">
            <h4>￥{{$agent->todayCash()}}</h4>
            <span></span>
            <p>今日收益</p>
        </div>
        <div class="flex-item">
            <h4>￥{{$agent->money}}</h4>
            <span></span>
            <p>可提现收益</p>
        </div>
        <div class="flex-item">
            <h4>120</h4>
            <span></span>
            <p>银票剩余</p>
        </div>
        <div class="flex-item">
            <h4>
                @if($agent->superagent_id == 0) 
                    @if($agent->level == 1)
                        {{$agent->divide}}% 
                    @elseif($agent->level == 2)
                        {{$parent_agent->divide * $agent->divide / 10000}}% 
                    @elseif($agent->level == 3)
                        {{$parent_agent->divide * $agent->divide / 100}}% 
                    @endif
                @else 
                    {{($agent->superagent->divide * $agent->divide) / 100}}% 
                @endif
            </h4>
            <span>
                @if($agent->superagent_id == 0)
                    @if($agent->level == 1)
                        1张银票分{{0.5*$agent->divide/100}}元
                    @elseif($agent->level == 2)
                        1张银票分{{0.5*$parent_agent->divide/100*$agent->divide/100}}元
                    @elseif($agent->level == 3)
                        1张银票分{{0.5*$parent_agent->divide/100*$agent->divide/100}}元
                    @endif
                @else
                    1张银票分{{0.5*(($agent->superagent->divide * $agent->divide) / 10000)}}元
                @endif 
            </span>
            <p>分成比例</p>
        </div>
    </div>
    <div class="rechargebtn flex">
        <div>
            <a href="/mobile/agent/withdraw/{{$agent->id}}">
                <img src="{{asset('/mobile/test/images/shouyi.png')}}">
            </a>
        </div>
<!--         <div>
            <a href="/mobile/agent/charge/{{$agent->id}}">
                <img src="{{asset('/mobile/test/images/chongzhi.png')}}">
            </a>
        </div> -->
    </div>
    <div class="entrance">
        <h4>推广</h4>
        <ul class="flex">
            @if($agent->level == 1)
                <li>
                    <a href="/mobile/agent/my_son/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_01.png')}}">
                        <span>推广代理</span>
                    </a>
                </li>
            @elseif($agent->level == 2)
                <li>
                    <a href="/mobile/agent/second_agent_son/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_01.png')}}">
                        <span>推广代理</span>
                    </a>
                </li>
            @endif
            @if($agent->level == 1)
                <li>
                    <a href="/mobile/agent/my_user/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_09.png')}}">
                        <span>我的玩家</span>
                    </a>
                </li>
            @elseif($agent->level == 2)
                <li>
                    <a href="/mobile/agent/my_son/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_09.png')}}">
                        <span>我的玩家</span>
                    </a>
                </li>
            @elseif($agent->level == 3)    
                 <li>
                    <a href="/mobile/agent/my_son/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_09.png')}}">
                        <span>我的玩家</span>
                    </a>
                </li>           
            @endif
            @if($agent->level == 2)
                <li>
                    <a href="/mobile/agent/my_parent/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_02.png')}}">
                        <span>上级推广</span>
                    </a>
                </li>
            @endif
            @if($agent->level == 1)
                <li>
                    <a href="/mobile/agent/audit_list/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_02.png')}}">
                        <span>推广审核</span>
                    </a>
                </li>
            @elseif($agent->level == 2)
                <li>
                    <a href="/mobile/agent/audit_list/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_02.png')}}">
                        <span>推广审核</span>
                    </a>
                </li>
            @endif
            <li>
                <a href="/mobile/agent/my_cash/{{$agent->id}}">
                    <img src="{{asset('/mobile/test/images/icon_05.png')}}">
                    <span>我的佣金</span>
                </a>
            </li>
            <li>
                <a href="/mobile/agent/income/{{$agent->id}}">
                    <img src="{{asset('/mobile/test/images/icon_08.png')}}">
                    <span>收入管理</span>
                </a>
            </li>
            @if($agent->level == 1)
                <li>
                    <a href="/mobile/agent/dvlp/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_03.png')}}">
                        <span>发展代理名片</span>
                    </a>
                </li>
            @elseif($agent->level == 2)
                <li>
                    <a href="/mobile/agent/second_dvlp/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_03.png')}}">
                        <span>发展代理名片</span>
                    </a>
                </li>
            @endif
            @if($agent->level == 1)
                <li>
                    <a href="/mobile/agent/dvlp_user/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_04.png')}}">
                        <span>发展玩家名片</span>
                    </a>
                </li>
            @elseif($agent->level == 2)
                <li>
                    <a href="/mobile/agent/dvlp/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_04.png')}}">
                        <span>发展玩家名片</span>
                    </a>
                </li>
            @elseif($agent->level == 3)   
                <li>
                    <a href="/mobile/agent/dvlp/{{$agent->id}}">
                        <img src="{{asset('/mobile/test/images/icon_04.png')}}">
                        <span>发展玩家名片</span>
                    </a>
                </li>
            @endif
        </ul>
        <h4>亲友圈</h4>
        <ul class="flex">
            @if($agent->open_circle == 1)
                @if($agent->hasClub())
                    <li>
                        <a href="/mobile/agent/friend_circle/control/{{$agent->id}}">
                            <img src="{{asset('/mobile/test/images/icon_07.png')}}">
                            <span>亲友圈</span>
                        </a>
                    </li>
                @else
                    <li>
                        <a href="/mobile/agent/friend_circle/create/{{$agent->id}}">
                            <img src="{{asset('/mobile/test/images/icon_07.png')}}">
                            <span>亲友圈</span>
                        </a>
                    </li>
                @endif
            @endif
            <li>
                <a href="/mobile/agent/rooms/{{$agent->id}}">
                    <img src="{{asset('/mobile/test/images/icon_08.png')}}">
                    <span>房间管理</span>
                </a>
            </li>
        </ul>
    </div>
    <div class="others">
        <ul>
            <ul>
                <li>
                    <a href="/mobile/agent/person/{{$agent->id}}">
                        <span>个人信息</span>
                        <i>完善个人资料、实名认证</i>
                    </a>    
                </li>
<!--                 <li>
                    <a href="#">
                        <span>帮助中心</span>
                        <i>规则、玩法详细说明</i>
                    </a>    
                </li> -->
            </ul>
        </ul>
    </div>
</body>
<script type="text/javascript" src="{{asset('/mobile/js/jquery-1.8.3.min.js')}}"></script>
<script type="text/javascript">
    $('.item').on('touchstart', function() {
        var myid = $(this).attr('data-id')
        console.log(myid)
    })
    $('#btnTX').on('touchstart', function() {
        console.log('提现')
    })
</script>
</html>
